# Maintainer: Willow Barraco <contact@willowbarraco.fr>
pkgname=ckb-next
pkgver=0.6.0
pkgrel=1
pkgdesc="RGB Driver for Linux"
url="https://github.com/ckb-next/ckb-next"
arch="all"
license="GPL-2.0-or-later"
makedepends="
	cmake
	eudev-dev
	libdbusmenu-qt-dev
	pulseaudio-dev
	qt5-qttools-dev
	qt5-qtx11extras-dev
	quazip-dev
	samurai
	xcb-util-wm-dev
	"
subpackages="
	$pkgname-dev
	$pkgname-daemon
	$pkgname-daemon-openrc
	"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/ckb-next/ckb-next/archive/refs/tags/v$pkgver.tar.gz
	983.patch
	"
options="!check" # no tests

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_INSTALL_LIBEXECDIR=lib \
		-DDISABLE_UPDATER=1 \
		-DUDEV_RULE_DIRECTORY=/usr/lib/udev/rules.d \
		-DFORCE_INIT_SYSTEM=openrc

	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

daemon() {
	amove usr/bin/ckb-next-daemon

	amove usr/lib/udev/rules.d
}

openrc() {
	default_openrc

	install_if="openrc $pkgname-daemon=$pkgver-r$pkgrel"
}

sha512sums="
34236199d420b663bb71db9400622bb868a3a0b384b58d5da3f80d2bd7ec9586d4e4ac9caad0b047b8440dc4200e4dd6077f4e0d1edb5a75a1327bf9c9ba9392  ckb-next-0.6.0.tar.gz
3ea2dfbe671005a013f66334c9d757fccc6dc2cf5bf5ed056ba9a7329378c3de43ee420150a774581e2f3b9b261069f140077ecf1cf6579fa11bfbc003532aa2  983.patch
"
